home *** CD-ROM | disk | FTP | other *** search
- #! /bin/sh
- ### BEGIN INIT INFO
- # Provides: tails-detect-virtualization
- # Required-Start: mountkernfs $local_fs
- # Required-Stop: $local_fs
- # Default-Start: S
- # Default-Stop:
- # Short-Description: Detect if we are running in a virtual machine
- # Description: Detect if we are running in a virtual machine
- ### END INIT INFO
-
- # Author: amnesia <amnesia@boum.org>
-
- # PATH should only include /usr/* if it runs after the mountnfs.sh script
- PATH=/usr/sbin:/usr/bin:/sbin:/bin
- DESC="Detecting if we are running in a virtual machine"
- NAME=tails-detect-virtualization
- VIRTWHAT=/usr/sbin/virt-what
- SCRIPTNAME=/etc/init.d/$NAME
-
- # Exit if virt-what is not installed
- [ -x "$VIRTWHAT" ] || exit 0
-
- # Load the VERBOSE setting and other rcS variables
- . /lib/init/vars.sh
-
- # Define LSB log_* functions.
- # Depend on lsb-base (>= 3.2-14) to ensure that this file is present
- # and status_of_proc is working.
- . /lib/lsb/init-functions
-
- do_start()
- {
- mkdir -p /var/lib/live
- /bin/bash "${VIRTWHAT}" > /var/lib/live/detected-virtual-machine
- }
-
- case "$1" in
- start)
- [ "$VERBOSE" != no ] && log_daemon_msg "$DESC" "$NAME"
- do_start
- case "$?" in
- 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
- 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
- esac
- ;;
- restart|reload|stop|force-reload)
- :
- ;;
- *)
- echo "Usage: $SCRIPTNAME start" >&2
- exit 3
- ;;
- esac
-
- :
-